package com.store.app.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.store.app.R;

import java.util.List;

/**
 * Created by lushan
 * on 2016/4/14 16:29 .
 */
public class BookedClassifyPopAdapter extends BaseAdapter {

    private Context mContext;
    private List<String> list;

    public BookedClassifyPopAdapter(Context c, List<String> beanlist) {
        this.mContext = c;
        this.list = beanlist;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(final int position, View view, ViewGroup parent) {
        Holder holder = null;
        if (view == null) {
            holder = new Holder();
            view = LayoutInflater.from(mContext).inflate(R.layout.item_bookedclassifypop_grid, null);
            holder.title = (TextView) view.findViewById(R.id.tv_bookedclassifypop_grid);
            view.setTag(holder);
        } else {
            holder = (Holder) view.getTag();
        }
        holder.title.setText(list.get(position));


        return view;
    }

    class Holder {
        TextView title;
    }

}
